package org.xczy.boot.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.xczy.boot.interceptor.MyHandlerInterceptor;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    // 注册拦截器
    registry.addInterceptor(new MyHandlerInterceptor()) // 实例化拦截器
        .addPathPatterns("/**") // 请求拦截的路径
        .excludePathPatterns("/login"); // 请求放行路径
  }
}
